package pe.edu.upc.dsd.epica.movil;


import pe.edu.upc.dsd.epica.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;

public class tipolugar extends Activity implements OnClickListener{
	//private static final String TAG = "tipolugar";
	 @Override
	   public void onCreate(Bundle savedInstanceState) {
	      super.onCreate(savedInstanceState);
	      setContentView(R.layout.tipolugar);

	      // Set up click listeners for all the buttons
	      View restaurantButton = findViewById(R.id.restaurant_button);
	      restaurantButton.setOnClickListener(this);
	      View cafeButton = findViewById(R.id.cafe_button);
	      cafeButton.setOnClickListener(this);
	      View barButton = findViewById(R.id.bar_button);
	      barButton.setOnClickListener(this);
	   }

	   @Override
	   protected void onResume() {
	      super.onResume();
	      Music.play(this, R.raw.main);
	   }

	   @Override
	   protected void onPause() {
	      super.onPause();
	      Music.stop(this);
	   }

	   public void onClick(View v) {
	      switch (v.getId()) {
	      case R.id.restaurant_button:       
	 		Intent j = new Intent(tipolugar.this,listaestablecimiento.class);
	         j.putExtra("Categoria", "R");
	         startActivity(j);
	         break;
	         // ...
	      case R.id.cafe_button:
	         Intent i = new Intent(this, listaestablecimiento.class);
	         i.putExtra("Categoria", "C");
	         startActivity(i);
	         break;
	         
	      case R.id.bar_button:
		         Intent k = new Intent(this, listaestablecimiento.class);
		         k.putExtra("Categoria", "B");
		         startActivity(k);
		         break;
	      }
	   }
	   
	   @Override
	   public boolean onCreateOptionsMenu(Menu menu) {
	      super.onCreateOptionsMenu(menu);
	      MenuInflater inflater = getMenuInflater();
	      inflater.inflate(R.menu.menu, menu);
	      return true;
	   }

	   @Override
	   public boolean onOptionsItemSelected(MenuItem item) {
	      switch (item.getItemId()) {
	      case R.id.settings:
	         startActivity(new Intent(this, Prefs.class));
	         return true;
	      // More items go here (if any) ...
	      }
	      return false;
	   }

	  
	}